const rules = function() {
  return {
    region: [{ required: true, message: '请选择地区', trigger: 'change' }],
    estateId: [
      { required: true, message: '请选择楼盘', trigger: 'change' }
    ],
    houseInfo: [
      {
        required: true,
        message: '请选择楼栋、单元',
        trigger: 'change'
      }
    ],
    houseNature: [
      { required: true, message: '请选择房屋类型', trigger: 'change' }
    ],
    houseType: [
      { required: true, message: '请选择房型类型', trigger: 'change' }
    ],
    // onlineRentalType: [
    //   { required: true, message: '请选择是否线上出租', trigger: 'change' }
    // ],
    roomNumber: [
      { required: true, message: '请输入房间号', trigger: 'blur' },
    ],
    houseArea: [{ required: true, message: '请输入面积', trigger: 'blur' },
      {
        validator: (rule, value, callback) => {
          if (value <= 0) {
            callback(new Error('面积需大于0'))
          }
          callback()
        }
      }
    ],
    roomType: [
      { required: true, message: '请输入户型', trigger: 'change' },
      {
        validator: (rule, value, callback) => {
          if (!this.form.roomType && !this.form.hall && !this.form.toilet) {
            callback(new Error('请输入户型数据'))
          }
          if (!this.form.roomType) {
            callback(new Error('请输入室'))
          }
          if (!this.form.hall) {
            callback(new Error('请输入厅'))
          }
          if (!this.form.toilet) {
            callback(new Error('请输入卫'))
          }
          callback()
        }
      }
    ],
    checkInNumber: [
      { required: true, message: '请输入可住人数', trigger: 'blur' },
      {
        validator: (rule, value, callback) => {
          if (value <= 0) {
            callback(new Error('可住人数需大于0'))
          }
          callback()
        }
      }
    ],
    houseOrientation: [
      { required: true, message: '请输入朝向', trigger: 'blur' },
      {
        min: 1,
        max: 10,
        message: '长度在 1 到 10 个字符',
        trigger: 'blur'
      }
    ],
    cooperationType: [
      { required: true, message: '请选择合作方式', trigger: 'change' }
    ],
    serviceCharge: [
      { required: true, message: '请输入账单服务费', trigger: 'blur' },
      {
        validator: (rule, value, callback) => {
          if (value >100) {
            callback(new Error('账单服务费不能大于100'))
          }
          callback()
        }
      }
    ],
    feeAmount: [
      { required: true, message: '请输入费用金额', trigger: 'blur' },
      {
        validator: (rule, value, callback) => {
          if (value <= 0) {
            callback(new Error('租金需大于0'))
          }
          callback()
        }
      }
    ],
    latestPaymentDate: [
      { required: true, message: '请选择最晚还款日期', trigger: 'change' }
    ],

    // housePropertyType: [
    //   { required: false, message: '请选择产权类型', trigger: 'change' }
    // ],
    // housePropertyOwner: [
    //   { required: false, message: '请选择产权所有人', trigger: 'change' }
    // ],
    // smartFurnitureType: [
    //   {
    //     required: true,
    //     message: '请选择是否为智能设备',
    //     trigger: 'change'
    //   }
    // ],
    houseManagerId: [
      { required: true, message: '请选择房管家', trigger: 'change' }
    ],
    proprietorUserId:[
      { required: true, message: '请选择业主', trigger: 'blur' }
    ],
    // propertyId: [
    //   { required: false, message: '请选择关联物业', trigger: 'change' }
    // ],
    floors: [{ required: true, message: '请选择楼层', trigger: 'change' }]
  }
}

export default rules
